import utils from '../../utils/util'
import {
  getAnnouncement
} from '../../api/index'

Page({
  data: {
    list: []
  },
  onLoad() {
    let that = this
    // console.log(getAnnouncement);
    async function getAnnouncementList() {
      let res = await getAnnouncement()
      if (res.data.code === 10000) {
        that.getList(res.data.data)
      }
    }
    getAnnouncementList()
  },
  getList(res) {
    this.setData({
      list: res
    })
  },
  goRouter(e) {
    let url = e.currentTarget.dataset.url
    let id = e.currentTarget.dataset.id
    if (id) {
      utils.navigate(url, id)
    } else {
      utils.navigate(url)
    }
  }

})